
/**
 * AppleIIGo
 * Disk II 13 Sector Interface Card class
 * (C) 2007-2008 by Marc S. Ressl (mressl@umich.edu)
 * Released under the GPL
 */

#include "DiskII13SectorInterfaceCard.h"

char * diskII13SectorDriveList[] = {
	"Apple525DiskDrive",
	"Apple525DiskDrive",
	0,
};

DiskII13SectorInterfaceCard::DiskII13SectorInterfaceCard(
	Motherboard * motherboard, char * slotDeviceName) :
DiskIIController(motherboard, slotDeviceName) {
	connectDrives(diskII13SectorDriveList);
}

void DiskII13SectorInterfaceCard::onMemoryRequested() {
	romMemoryOffset = motherboard->getMemory()->requestMemory(
		DISKII13SECTORINTERFACECARD_ROM_BYTENUM);
}

void DiskII13SectorInterfaceCard::onMemoryAllocated() {
	romMemory = motherboard->getMemory()->getMemory(romMemoryOffset);
	char * romImage = "Apple Disk II 13 Sector Interface Card P5 ROM.bin";
	motherboard->getResources()->readResource(romMemory, 
		DISKII13SECTORINTERFACECARD_ROM_BYTENUM, romImage);
}

UINT8 DiskII13SectorInterfaceCard::readMemory(UINT16 address) {
	if (address & 0x800)
		return timingGenerator->readFloatingBus();
	else
		return romMemory[address & 0xff];
}
